#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long;

my $strg="";
my @cryp;


GetOptions("pwd=s" => \$strg);

if ($strg) {
	chomp $strg;
	print "pwd: $strg\n";
	@cryp=unpack("C*",$strg);
	foreach (@cryp){
	$_++;}
	$strg=pack("C*",@cryp);
	$strg=ucfirst(reverse(substr($strg,0,length($strg)/2))).reverse(substr(ucfirst($strg),length($strg)/2));
	print "encrypted pwd: $strg\n";

	@cryp=unpack("C*",$strg);
	foreach (@cryp){$_--;}

	$strg=pack("C*",@cryp);
	$strg=reverse(substr(lcfirst($strg),0,length($strg)/2)).lcfirst(reverse(substr($strg,length($strg)/2)));

	print "decrypted pwd: $strg\n";

} else {
	print "nothing specified - please provide argument\n";
}
